package com.hlg.xboot.model.sys;

import com.hlg.xboot.enums.PrivilegeType;
import com.hlg.xboot.model.BaseModel;

import javax.persistence.Column;
import javax.persistence.Entity;

/**
 * <p>Description:</p>
 *
 * @author gaol
 * @version 1.0
 * @date 2017/5/17
 */
@Entity
public class Permission extends BaseModel {

    /**
     * 路径
     */
    @Column(length = 20, nullable = false)
    private String path;

    /**
     * 名称
     */
    @Column(length = 25, nullable = false)
    private String name;


    /**
     * 权限类型
     * 1：菜单
     * 2：按钮
     */
    @Column(length = 1, nullable = false)
    private Integer type;

    /**
     * 请求类型（POST、GET、PUT、DELETE...）
     */
    @Column(length = 10)
    private String method;

    /**
     * 排序
     */
    @Column(length = 20)
    private Integer sort;

    /**
     * 上级目录ID(权限ID)
     */
    private Long pid;

    /**
     * 图标
     */
    @Column(length = 25)
    private String icon;


    /**
     * 说明
     */
    @Column(length = 100)
    private String description;


    public Permission() {
    }

    public Permission(String path, String name, String method) {
        this.path = path;
        this.name = name;
        this.type = PrivilegeType.BUTTON.getValue();
        this.method = method;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Long getPid() {
        return pid;
    }

    public void setPid(Long pid) {
        this.pid = pid;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
}
